﻿// 项目：	Guan.CMS.Web - Guan.CMS
// 文件名：	ArticleListViewModel.cs
// 
// 修改时间：2013-03-09 13:14
// 修改人：	Cooclsee

using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace Guan.CMS.Web.ViewModels.Article
{
    public class ArticleListViewModel
    {
        public int Id { get; set; }
        /// <summary>
        /// 标题
        /// </summary>
        [DisplayName("标题")]
        public string Title { get; set; }

        /// <summary>
        /// 正文内容
        /// </summary>
        [DisplayName("正文")]
        public string Body { get; set; }

        /// <summary>
        /// 已发布
        /// </summary>
        [DisplayName("已发布")]
        public bool IsPublished { get; set; }

        /// <summary>
        /// 已删除
        /// </summary>
        [DisplayName("已删除")]
        public bool IsDeleted { get; set; }

        /// <summary>
        /// 标签
        /// </summary>
        [DisplayName("标签")]
        public string Tags { get; set; }

        /// <summary>
        /// 作者
        /// </summary>
        [DisplayName("作者")]
        public string Author { get; set; }

        /// <summary>
        /// 阅读数
        /// </summary>
        public int Hits { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        [DisplayName("开始时间"), DisplayFormat(DataFormatString = "{0:yyyy-MM-dd HH:mm:ss}")]
        public DateTime? StartTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        [DisplayName("结束时间"), DisplayFormat(DataFormatString = "{0:yyyy-MM-dd HH:mm:ss}")]
        public DateTime? EndTime { get; set; }

        /// <summary>
        /// 添加时间
        /// </summary>
        [DisplayName("添加时间"), DisplayFormat(DataFormatString = "{0:yyyy-MM-dd HH:mm:ss}")]
        public DateTime CreatedTime { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        [DisplayName("更新时间"), DisplayFormat(DataFormatString = "{0:yyyy-MM-dd HH:mm:ss}")]
        public DateTime UpdatedTime { get; set; }

        #region 扩展属性

        /// <summary>
        /// 已过期
        /// </summary>
        [DisplayName("已过期")]
        public bool IsExpire
        {
            get { return EndTime.HasValue && EndTime.Value < DateTime.Now; }
        }

        #endregion

        #region Category

        public int CategoryId { get; set; }
        [DisplayName("分类")]
        public string CategoryName { get; set; }

        #endregion
    }
}